import { DateTransformer } from './../utils/dateTransformer';
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn } from 'typeorm';
import { Exclude, Expose, Transform, Type } from 'class-transformer';
import { CommonEntity } from './common.entity';

@Entity('resource')
export class ResourceEntity {
    // 将 int 类型的id转成string类型，防止前端精度缺失

    @PrimaryGeneratedColumn({ type: 'bigint' })
    id: string;

    @Column({ type: 'bigint' })
    videoId: string;

    @Column({ comment: '资源类型', type: 'varchar' })
    sourceType: string;

    @Column({ comment: '资源地址' })
    url: string;

    @Column({ comment: '资源排序' })
    sort: number;

    @CreateDateColumn({ precision: 0, transformer: new DateTransformer() })
    createTime: Date;
}    